package com.woniuxy.carlife.controller;


import com.woniuxy.carlife.carlifecommonsweb.responsetemplate.Result;
import com.woniuxy.carlife.carlifecommonsweb.responsetemplate.StatusCode;
import com.woniuxy.carlife.domain.ServiceInfo;
import com.woniuxy.carlife.dto.ServiceInfoDto;
import com.woniuxy.carlife.param.ServiceInfoParam;
import com.woniuxy.carlife.param.ServiceInfoPicParam;
import com.woniuxy.carlife.param.ServiceStatus;
import com.woniuxy.carlife.param.UserLikeServiceParam;
import com.woniuxy.carlife.service.ServiceInfoService;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.io.IOException;
import java.util.List;

/**
 * @author fx
 * @ClassName:ServiceInfoController
 * @Description: 服务详情控制类
 * @date 2021/4/6 20:00
 **/

@RestController
@RequestMapping("/serviceInfo")
@Api(tags = "服务详情接口信息")
@Slf4j
public class ServiceInfoController {

    @Resource
    private ServiceInfoService service;

    /**
     * 功能描述〈添加服务详情〉
     * @author:fx
     * @param: @param null:
     * @return:
     * @Date 2021/4/8 9:40
     * @throws
     */
    @ApiOperation(value = "添加服务详情",notes = "<span style='color:red;'>添加服务详情</span>")
    //@ApiResponses用于描述响应状态信息
    @ApiResponses({
            @ApiResponse(code = 20000,message = "新增服务详情成功"),
            @ApiResponse(code=20001,message = "新增服务详情失败")
    })
    @PostMapping("/merchantmanage/serviceinfo")
    public Result saveServiceInfo(@RequestBody @ApiParam ServiceInfoParam serviceInfo) throws IOException {
        log.info("saveServiceInfo开始:参数：{}",serviceInfo);
        //判断参数
        if (serviceInfo.getServiceInfoName().trim().length()==0||
            serviceInfo.getServiceInfoName()==null||
            serviceInfo.getServiceCategoryId()<=0||
            serviceInfo.getServiceCategoryId()==null||
            serviceInfo.getStoreId()<=0||
            serviceInfo.getStoreId()==null||
            serviceInfo.getServiceCategoryName().trim().length()==0||
            serviceInfo.getServiceCategoryName()==null)
        {
            log.info("saveServiceInfo:结束：返回:{}","传入参数错误");
            return new Result(false,StatusCode.PARAMERROR,"传入参数错误");
        }
        boolean b = service.saveServiceInfo(serviceInfo);
        if (b){
            log.info("saveServiceInfo结束:返回：{}","新增服务详情成功");
            return new Result(true, StatusCode.OK,"新增服务详情成功");
        }
        log.info("saveServiceInfo结束:返回：{}","新增服务详情失败");
        return new Result(false, StatusCode.ERROR,"新增服务详情失败");
    }

    /**
     * 功能描述〈上传服务图标〉
     * @author:fx
     * @param: @param null:
     * @return:
     * @Date 2021/4/13 4:26
     * @throws
     */
    @ApiOperation(value = "上传服务图标",notes = "<span style='color:red;'>上传服务图标，单张图片大小限制为1m</span>")
    //@ApiResponses用于描述响应状态信息
    @ApiResponses({
            @ApiResponse(code = 20000,message = "上传服务图标成功"),
            @ApiResponse(code=20001,message = "上传文件格式错误")
    })
    @PostMapping("/merchantmanage/serviceicon")
    public Result saveServiceInfoIcon(@ModelAttribute @ApiParam MultipartFile icon) throws IOException {
        log.info("saveServiceInfo开始:参数：{}",icon);
        if (ObjectUtils.isEmpty(icon)){
            return new Result(false,StatusCode.ERROR,"上传文件格式错误");
        }
        String s = service.saveServiceInfoIcon(icon);
        log.info("saveServiceInfo结束:返回:{}",s);
        return new Result(true,StatusCode.OK,"上传图片成功",s);
    }

    /**
     * 功能描述〈上传服务图文详情〉
     * @author:fx
     * @param: @param null:
     * @return:
     * @Date 2021/4/13 4:31
     * @throws
     */
    @ApiOperation(value = "上传服务图文详情",notes = "<span style='color:red;'>上传服务图文详情，可多张图片，单张图片大小限制为1m</span>")
    //@ApiResponses用于描述响应状态信息
    @ApiResponses({
            @ApiResponse(code = 20000,message = "上传服务图文详情成功"),
            @ApiResponse(code=20001,message = "上传文件格式错误")
    })
    @PostMapping("/merchantmanage/infopic")
    public String saveServiceInfoPic(@ModelAttribute List<MultipartFile> pic) throws IOException {
        log.info("saveServiceInfoPic开始:参数：{}",pic);
        if (ObjectUtils.isEmpty(pic)){
            return "上传文件格式错误";
        }
        String s = service.saveServiceInfoPic(pic);
        log.info("saveServiceInfoPic开始结束:返回:{}",s);
        return s;
    }

    /**
     * 功能描述〈根据门店id查询指定门店的服务〉
     * @author:fx
     * @param: @param null:
     * @return:
     * @Date 2021/4/8 9:43
     * @throws
     */
    @ApiOperation(value = "根据门店id查询指定门店的服务",notes = "<span style='color:red;'>根据门店id查询指定门店的服务</span>")
    //@ApiResponses用于描述响应状态信息
    @ApiResponses({
            @ApiResponse(code = 20000,message = "查询成功",response = ServiceInfoDto.class),
            @ApiResponse(code=20001,message = "查询失败"),
            @ApiResponse(code=00000,message = "没有数据"),
            @ApiResponse(code=30001,message = "参数错误")
    })
    @ApiImplicitParams({
            @ApiImplicitParam(name = "storeId",value = "门店id",dataType = "Integer",paramType = "query",example = "1"),
    })
    @GetMapping("storeservice")
    public Result findStoreServiceByStoreId(Integer storeId){
        log.info("findStoreServiceByStoreId开始:参数：{}",storeId);
        if (storeId==null||storeId<=0){
            log.info("findStoreServiceByStoreId结束:返回：{}","传入参数为空或者小于1");
            return new Result(false, StatusCode.PARAMERROR,"传入参数错误");
        }
        List<ServiceInfoDto> serviceInfoByStoreId = service.findServiceInfoByStoreId(storeId);
        if (ObjectUtils.isEmpty(serviceInfoByStoreId)){
            log.info("findStoreServiceByStoreId结束:返回：{}","查询失败，没有查到数据");
            return new Result(false, StatusCode.NULLDATA,"查询失败，没有数据");
        }
        log.info("findStoreServiceByStoreId结束:返回：{}",serviceInfoByStoreId);
        return new Result(true, StatusCode.OK,"查询成功",serviceInfoByStoreId);
    }

    /**
     * 功能描述〈根据门店id获得已上架的服务详情〉
     * @author:fx
     * @param: @param null:
     * @return:
     * @Date 2021/4/8 9:44
     * @throws
     */
    @ApiOperation(value = "根据门店id获得已上架的服务详情",notes = "<span style='color:red;'>根据门店id获得已上架的服务详情</span>")
    //@ApiResponses用于描述响应状态信息
    @ApiResponses({
            @ApiResponse(code = 20000,message = "查询成功",response = ServiceInfoDto.class),
            @ApiResponse(code=20001,message = "查询失败"),
            @ApiResponse(code=00000,message = "没有数据"),
            @ApiResponse(code=30001,message = "参数错误")
    })
    @ApiImplicitParams({
            @ApiImplicitParam(name = "storeId",value = "门店id",dataType = "Integer",paramType = "query",example = "1"),
    })
    @GetMapping("serviceinfoup")
    public Result findServcieInfoByStoreIdAndAlreadyUp(Integer storeId){
        log.info("findServcieInfoByStoreIdAndAlreadyUp开始:参数：{}",storeId);
        if (storeId==null||storeId<=0){
            log.info("findServcieInfoByStoreIdAndAlreadyUp结束:返回：{}","传入参数为空或者小于1");
            return new Result(false, StatusCode.PARAMERROR,"传入参数错误");
        }
        List<ServiceInfoDto> servcieInfoByStoreIdAndAlreadyUp =
                service.findServcieInfoByStoreIdAndAlreadyUp(storeId);
        if (ObjectUtils.isEmpty(servcieInfoByStoreIdAndAlreadyUp)){
            log.info("findServcieInfoByStoreIdAndAlreadyUp结束:返回：{}","查询失败，没有数据");
            return new Result(false, StatusCode.NULLDATA,"查询失败，没有数据");
        }
        log.info("findServcieInfoByStoreIdAndAlreadyUp结束:返回：{}",servcieInfoByStoreIdAndAlreadyUp);
        return new Result(true, StatusCode.OK,"查询已上架服务成功",servcieInfoByStoreIdAndAlreadyUp);
    }

    /**
     * 功能描述〈根据门店id查询营业中的服务详情〉
     * @author:fx
     * @param: @param null:
     * @return:
     * @Date 2021/4/8 9:49
     * @throws
     */
    @ApiOperation(value = "根据门店id查询营业中的服务详情",notes = "<span style='color:red;'>根据门店id查询营业中的服务详情</span>")
    //@ApiResponses用于描述响应状态信息
    @ApiResponses({
            @ApiResponse(code = 20000,message = "查询成功",response = ServiceInfoDto.class),
            @ApiResponse(code=20001,message = "查询失败"),
            @ApiResponse(code=00000,message = "没有数据"),
            @ApiResponse(code=30001,message = "参数错误")
    })
    @ApiImplicitParams({
            @ApiImplicitParam(name = "storeId",value = "门店id",dataType = "Integer",paramType = "query",example = "1"),
    })
    @GetMapping("servicesdo")
    public Result findServcieInfoByStoreIdAndDoing(Integer storeId){
        log.info("findServcieInfoByStoreIdAndDoing开始:参数：{}",storeId);
        if (storeId==null||storeId<=0){
            log.info("findServcieInfoByStoreIdAndDoing结束:返回：{}","传入参数为空或者小于1");
            return new Result(false, StatusCode.PARAMERROR,"传入参数错误");
        }
        List<ServiceInfoDto> servcieInfoByStoreIdAndDoing =
                service.findServcieInfoByStoreIdAndDoing(storeId);
        if (ObjectUtils.isEmpty(servcieInfoByStoreIdAndDoing)){
            log.info("findServcieInfoByStoreIdAndDoing结束:返回：{}","查询失败，没有数据");
            return new Result(false, StatusCode.NULLDATA,"查询失败，没有数据");
        }
        log.info("findServcieInfoByStoreIdAndDoing结束:返回：{}",servcieInfoByStoreIdAndDoing);
        return new Result
                (true, StatusCode.OK,
                        "查询营业中服务成功",
                            servcieInfoByStoreIdAndDoing);
    }

    /**
     * 功能描述〈根据门店id查询未营业的服务详情〉
     * @author:fx
     * @param: @param null:
     * @return:
     * @Date 2021/4/12 12:09
     * @throws
     */
    @ApiOperation(value = "根据门店id查询未营业的服务详情",notes = "<span style='color:red;'>根据门店id查询未营业的服务详情</span>")
    //@ApiResponses用于描述响应状态信息
    @ApiResponses({
            @ApiResponse(code = 20000,message = "查询成功",response = ServiceInfoDto.class),
            @ApiResponse(code=20001,message = "查询失败"),
            @ApiResponse(code=00000,message = "没有数据"),
            @ApiResponse(code=30001,message = "参数错误")
    })
    @ApiImplicitParams({
            @ApiImplicitParam(name = "storeId",value = "门店id",dataType = "Integer",paramType = "query",example = "1"),
    })
    @GetMapping("/merchantmanage/servicenotdo")
    public Result findServcieInfoByStoreIdAndNotDoing(Integer storeId){
        log.info("findServcieInfoByStoreIdAndNotDoing开始:参数：{}",storeId);
        if (storeId==null||storeId<=0){
            log.info("findServcieInfoByStoreIdAndNotDoing结束:返回：{}","传入参数为空或者小于1");
            return new Result(false, StatusCode.PARAMERROR,"传入参数错误");
        }
        List<ServiceInfoDto> servcieInfoByStoreIdAndNotDoing =
                service.findServcieInfoByStoreIdAndNotDoing(storeId);
        if (ObjectUtils.isEmpty(servcieInfoByStoreIdAndNotDoing)){
            log.info("findServcieInfoByStoreIdAndNotDoing结束:返回：{}","查询失败，没有数据");
            return new Result(false, StatusCode.NULLDATA,"查询失败，没有数据");
        }
        log.info("findServcieInfoByStoreIdAndNotDoing结束:返回：{}",servcieInfoByStoreIdAndNotDoing);
        return new Result
                (true, StatusCode.OK,
                        "查询未营业服务成功",
                        servcieInfoByStoreIdAndNotDoing);
    }

    /**
     * 功能描述〈根据服务id查询指定服务详情〉
     * @author:fx
     * @param: @param null:
     * @return:
     * @Date 2021/4/12 12:05
     * @throws
     */
    @ApiOperation(value = "根据服务id查询指定服务详情",notes = "<span style='color:red;'>根据服务id查询指定服务详情</span>")
    //@ApiResponses用于描述响应状态信息
    @ApiResponses({
            @ApiResponse(code = 20000,message = "查询成功",response = ServiceInfoDto.class),
            @ApiResponse(code=20001,message = "查询失败"),
            @ApiResponse(code=00000,message = "没有数据"),
            @ApiResponse(code=30001,message = "参数错误")
    })
    @GetMapping("serviceid")
    public Result findServcieInfoByServiceInfoId(Integer infoId){
        log.info("findServcieInfoByServiceInfoId开始:参数：{}",infoId);
        if (infoId==null||infoId<=0){
            log.info("findServcieInfoByServiceInfoId结束:返回：{}","传入参数为空或者小于1");
            return new Result(false, StatusCode.PARAMERROR,"传入参数错误");
        }
        ServiceInfoDto servcieInfoByServiceInfoId =
                service.findServcieInfoByServiceInfoId(infoId);
        if (ObjectUtils.isEmpty(servcieInfoByServiceInfoId)){
            log.info("findServcieInfoByServiceInfoId结束:返回：{}","查询失败，没有数据");
            return new Result(false, StatusCode.NULLDATA,"查询失败，没有数据");
        }
        log.info("findServcieInfoByServiceInfoId结束:返回：{}",servcieInfoByServiceInfoId);
        return new Result
                (true, StatusCode.OK,
                        "查询指定服务成功",
                        servcieInfoByServiceInfoId);
    }

    /**
     * 功能描述〈根据服务id增加服务收藏量redis〉
     * @author:fx
     * @param: @param null:
     * @return:
     * @Date 2021/4/12 12:05
     * @throws
     */
    @ApiOperation(value = "根据服务id增加服务收藏量",notes = "<span style='color:red;'>根据服务id增加服务收藏量</span>")
    //@ApiResponses用于描述响应状态信息
    @ApiResponses({
            @ApiResponse(code = 20000,message = "收藏服务成功"),
            @ApiResponse(code=20001,message = "收藏服务失败"),
            @ApiResponse(code=30001,message = "参数错误")
    })
    @ApiImplicitParams({
            @ApiImplicitParam(name = "infoId",value = "服务id",dataType = "Integer",paramType = "query",example = "1"),
    })
    @PutMapping("/ordinary/servicecup")
    public Result updateUpServcieInfoCollectByServiceInfoIdToRedis(Integer infoId){
        log.info("updateUpServcieInfoCollectByServiceInfoIdToRedis开始:参数：{}",infoId);
        if (infoId==null||infoId<=0){
            log.info("updateUpServcieInfoCollectByServiceInfoIdToRedis结束:返回：{}","传入参数为空或者小于1");
            return new Result(false, StatusCode.PARAMERROR,"传入参数错误");
        }
        Boolean b = service.updateUpServcieInfoCollectByServiceInfoIdToRedis(infoId);
        if (b){
            log.info("findServcieInfoByServiceInfoId结束:返回：{}","收藏服务成功");
            return new Result
                    (true, StatusCode.OK,
                            "收藏服务成功");
        }
        log.info("findServcieInfoByServiceInfoId结束:返回：{}","收藏服务失败");
        return new Result
                (false, StatusCode.ERROR,
                        "收藏服务失败");
    }

    /**
     * 功能描述〈根据服务id减少收藏量redis〉
     * @author:fx
     * @param: @param null:
     * @return:
     * @Date 2021/4/12 12:06
     * @throws
     */
    @ApiOperation(value = "根据服务id减少收藏量",notes = "<span style='color:red;'>根据服务id减少收藏量</span>")
    //@ApiResponses用于描述响应状态信息
    @ApiResponses({
            @ApiResponse(code = 20000,message = "取消收藏服务成功"),
            @ApiResponse(code=20001,message = "取消收藏服务失败"),
            @ApiResponse(code=30001,message = "参数错误")
    })
    @ApiImplicitParams({
            @ApiImplicitParam(name = "infoId",value = "服务id",dataType = "Integer",paramType = "query",example = "1"),
    })
    @PutMapping("/ordinary/servicecdown")
    public Result updateDownServcieInfoCollectByServiceInfoIdToRedis(Integer infoId){
        log.info("updateDownServcieInfoCollectByServiceInfoIdToRedis开始:参数：{}",infoId);
        if (infoId==null||infoId<=0){
            log.info("updateDownServcieInfoCollectByServiceInfoIdToRedis结束:返回：{}","传入参数为空或者小于1");
            return new Result(false, StatusCode.PARAMERROR,"传入参数错误");
        }
        Boolean b = service.updateDownServcieInfoCollectByServiceInfoIdToRedis(infoId);
        if (b){
            log.info("findServcieInfoByServiceInfoId结束:返回：{}","取消收藏服务成功");
            return new Result
                    (true, StatusCode.OK,
                            "取消收藏服务成功");
        }
        log.info("findServcieInfoByServiceInfoId结束:返回：{}","取消收藏服务失败");
        return new Result
                (false, StatusCode.ERROR,
                        "取消收藏服务失败");
    }

    /**
     * 功能描述〈根据用户id和服务id增加或取消点赞量redis〉
     * @author:fx
     * @param: @param null:
     * @return:
     * @Date 2021/4/12 12:06
     * @throws
     */
    @ApiOperation(value = "根据用户id和服务id增加或取消点赞量redis",notes = "<span style='color:red;'>根据用户id和服务id增加或取消点赞量redis</span>")
    //@ApiResponses用于描述响应状态信息
    @ApiResponses({
            @ApiResponse(code = 20000,message = "点赞服务成功"),
            @ApiResponse(code=20001,message = "点赞服务失败"),
            @ApiResponse(code=30001,message = "参数错误")
    })
    @ApiImplicitParams({
            @ApiImplicitParam(name = "serviceId",value = "服务id",dataType = "Integer",paramType = "query",example = "1"),
            @ApiImplicitParam(name = "userId",value = "用户id",dataType = "Integer",paramType = "query",example = "1"),
    })
    @PutMapping("/ordinary/servicelup")
    public Result updateServcieInfoLikeByServiceInfoIdAndUserIdToRedis(@RequestBody @ApiParam UserLikeServiceParam like){
        log.info("updateServcieInfoLikeByServiceInfoIdAndUserIdToRedis开始:参数：{}",like);
        if (like.getUserId()==null||like.getUserId()<=0||
            like.getServiceId()==null||like.getServiceId()<=0){
            log.info("updateServcieInfoLikeByServiceInfoIdAndUserIdToRedis结束:返回：{}","传入参数为空或者小于1");
            return new Result(false, StatusCode.PARAMERROR,"传入参数错误");
        }
        Boolean b = service.updateUpServcieInfoLikeByServiceInfoIdToRedis(like);
        if (b){
            log.info("updateServcieInfoLikeByServiceInfoIdAndUserIdToRedis结束:返回：{}","点赞服务成功");
            return new Result
                    (true, StatusCode.OK,
                            "点赞服务成功");
        }
        log.info("updateServcieInfoLikeByServiceInfoIdAndUserIdToRedis结束:返回：{}","点赞服务失败");
        return new Result
                (false, StatusCode.ERROR,
                        "点赞服务失败");
    }

    /**
     * 功能描述〈根据服务id减少点赞量redis〉
     * @author:fx
     * @param: @param null:
     * @return:
     * @Date 2021/4/12 12:06
     * @throws
     */
//    @ApiOperation(value = "根据服务id减少点赞量",notes = "<span style='color:red;'>根据服务id减少点赞量</span>")
//    //@ApiResponses用于描述响应状态信息
//    @ApiResponses({
//            @ApiResponse(code = 20000,message = "取消点赞服务成功"),
//            @ApiResponse(code=20001,message = "取消点赞服务失败"),
//            @ApiResponse(code=30001,message = "参数错误")
//    })
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "infoId",value = "服务id",dataType = "Integer",paramType = "query",example = "1"),
//    })
//    @PutMapping("/ordinary/serviceldown")
//    public Result updateDownServcieInfoLikeByServiceInfoIdToRedis(Integer infoId){
//        log.info("updateDownServcieInfoLikeByServiceInfoIdToRedis开始:参数：{}",infoId);
//        if (infoId==null||infoId<=0){
//            log.info("updateDownServcieInfoLikeByServiceInfoIdToRedis结束:返回：{}","传入参数为空或者小于1");
//            return new Result(false, StatusCode.PARAMERROR,"传入参数错误");
//        }
//        Boolean b = impl.updateDownServcieInfoLikeByServiceInfoIdToRedis(infoId);
//        if (b){
//            log.info("findServcieInfoByServiceInfoId结束:返回：{}","取消点赞服务成功");
//            return new Result
//                    (true, StatusCode.OK,
//                            "取消点赞服务成功");
//        }
//        log.info("findServcieInfoByServiceInfoId结束:返回：{}","取消点赞服务失败");
//        return new Result
//                (false, StatusCode.ERROR,
//                        "取消点赞服务失败");
//    }

    /**
     * 功能描述〈根据服务id修改服务状态为营业中〉
     * @author:fx
     * @param: @param null:
     * @return:
     * @Date 2021/4/12 12:06
     * @throws
     */
    @ApiOperation(value = "根据服务id修改服务状态为营业中",notes = "<span style='color:red;'>根据服务id修改服务状态为营业中</span>")
    //@ApiResponses用于描述响应状态信息
    @ApiResponses({
            @ApiResponse(code = 20000,message = "修改状态成功"),
            @ApiResponse(code=20001,message = "修改状态失败"),
            @ApiResponse(code=30001,message = "参数错误")
    })
    @ApiImplicitParams({
            @ApiImplicitParam(name = "infoId",value = "服务id",dataType = "Integer",paramType = "query",example = "1"),
    })
    @PutMapping("/merchantmanage/servicestatusing")
    public Result updateServiceInfoStatusToDoing(Integer infoId){
        log.info("updateServiceInfoStatusToDoing开始:参数：{}",infoId);
        if (infoId==null||infoId<=0){
            log.info("updateServiceInfoStatusToDoing结束:返回：{}","传入参数为空或者小于1");
            return new Result(false, StatusCode.PARAMERROR,"传入参数错误");
        }
        Boolean b = service.updateServiceInfoStatusToDoing(infoId);
        if (b){
            log.info("updateServiceInfoStatusToDoing结束:返回：{}","修改状态成功");
            return new Result
                    (true, StatusCode.OK,
                            "修改状态成功");
        }
        log.info("updateServiceInfoStatusToDoing结束:返回：{}","修改状态失败");
        return new Result
                (false, StatusCode.ERROR,
                        "修改状态失败");
    }

    /**
     * 功能描述〈根据服务id修改服务状态为未营业〉
     * @author:fx
     * @param: @param null:
     * @return:
     * @Date 2021/4/12 12:07
     * @throws
     */
    @ApiOperation(value = "根据服务id修改服务状态为未营业",notes = "<span style='color:red;'>根据服务id修改服务状态为未营业</span>")
    //@ApiResponses用于描述响应状态信息
    @ApiResponses({
            @ApiResponse(code = 20000,message = "修改状态成功"),
            @ApiResponse(code=20001,message = "修改状态失败"),
            @ApiResponse(code=30001,message = "参数错误")
    })
    @ApiImplicitParams({
            @ApiImplicitParam(name = "infoId",value = "服务id",dataType = "Integer",paramType = "query",example = "1"),
    })
    @PutMapping("/merchantmanage/servicestatusst")
    public Result updateServiceInfoStatusToNotDoing(Integer infoId){
        log.info("updateServiceInfoStatusToNotDoing开始:参数：{}",infoId);
        if (infoId==null||infoId<=0){
            log.info("updateServiceInfoStatusToNotDoing结束:返回：{}","传入参数为空或者小于1");
            return new Result(false, StatusCode.PARAMERROR,"传入参数错误");
        }
        Boolean b = service.updateServiceInfoStatusToNotDoing(infoId);
        if (b){
            log.info("updateServiceInfoStatusToNotDoing结束:返回：{}","修改状态成功");
            return new Result
                    (true, StatusCode.OK,
                            "修改状态成功");
        }
        log.info("updateServiceInfoStatusToNotDoing结束:返回：{}","修改状态失败");
        return new Result
                (false, StatusCode.ERROR,
                        "修改状态失败");

    }

    /**
     * 功能描述〈下架服务〉
     * @author:fx
     * @param: @param null:
     * @return:
     * @Date 2021/4/12 12:10
     * @throws
     */
    @ApiOperation(value = "下架服务",notes = "<span style='color:red;'>下架服务</span>")
    //@ApiResponses用于描述响应状态信息
    @ApiResponses({
            @ApiResponse(code = 20000,message = "下架成功"),
            @ApiResponse(code=20001,message = "下架失败"),
            @ApiResponse(code=30001,message = "参数错误")
    })
    @ApiImplicitParams({
            @ApiImplicitParam(name = "infoId",value = "服务id",dataType = "Integer",paramType = "query",example = "1"),
    })
    @PutMapping("/merchantmanage/servicestatusdown")
    public Result updateServiceInfoStatusToDown(Integer infoId){
        log.info("updateServiceInfoStatusToDown开始:参数：{}",infoId);
        if (infoId==null||infoId<=0){
            log.info("updateServiceInfoStatusToDown结束:返回：{}","传入参数为空或者小于1");
            return new Result(false, StatusCode.PARAMERROR,"传入参数错误");
        }
        Boolean b = service.updateServiceInfoStatusToDown(infoId);
        if (b){
            log.info("updateServiceInfoStatusToDown结束:返回：{}","下架成功");
            return new Result
                    (true, StatusCode.OK,
                            "修改状态成功");
        }
        log.info("updateServiceInfoStatusToDown结束:返回：{}","下架失败");
        return new Result
                (false, StatusCode.ERROR,
                        "修改状态失败");
    }

    /**
     * 功能描述〈修改服务图片〉
     * @author:fx
     * @param: @param null:
     * @return:
     * @Date 2021/4/14 16:54
     * @throws
     */
    @ApiOperation(value = "修改服务图片",notes = "<span style='color:red;'>修改服务图片</span>")
    //@ApiResponses用于描述响应状态信息
    @ApiResponses({
            @ApiResponse(code = 20000,message = "修改成功"),
            @ApiResponse(code=20001,message = "修改失败"),
            @ApiResponse(code=30001,message = "参数错误")
    })
    @PutMapping("/merchantmanage/serviceinfoicon")
    public Result updateServiceInfoIcon(@RequestBody @ApiParam ServiceInfoPicParam picParam){
        log.info("updateServiceInfoIcon开始:参数:{}",picParam);
        if (picParam.getInfoId()==null||
            picParam.getInfoId()<=0||
            picParam.getPic().trim().length()==0||
            picParam.getPic().trim()==null)
        {
            log.info("updateServiceInfoIcon结束:返回:{}","传入参数错误");
            return  new Result(false,StatusCode.PARAMERROR,"传入参数错误");
        }
        Boolean b = service.updateServiceInfoIcon(picParam);
        if (b){
            log.info("updateServiceInfoIcon结束:返回:{}","修改服务图标成功");
            return  new Result(true,StatusCode.OK,"修改服务图标成功");
        }
        log.info("updateServiceInfoIcon结束:返回:{}","修改服务图标失败");
        return  new Result(false,StatusCode.ERROR,"修改服务图标失败");
    }

    /**
     * 功能描述〈修改服务详情图片〉
     * @author:fx
     * @param: @param null:
     * @return:
     * @Date 2021/4/14 16:54
     * @throws
     */
    @ApiOperation(value = "修改服务详情图片",notes = "<span style='color:red;'>修改服务详情图片</span>")
    //@ApiResponses用于描述响应状态信息
    @ApiResponses({
            @ApiResponse(code = 20000,message = "修改成功"),
            @ApiResponse(code=20001,message = "修改失败"),
            @ApiResponse(code=30001,message = "参数错误")
    })
    @PutMapping("/merchantmanage/serviceinfopic")
    public Result updateServiceInfoPic(@RequestBody @ApiParam ServiceInfoPicParam picParam){
        log.info("updateServiceInfoPic开始:参数:{}",picParam);
        if (picParam.getInfoId()==null||
                picParam.getInfoId()<=0||
                picParam.getPic().trim().length()==0||
                picParam.getPic().trim()==null)
        {
            log.info("updateServiceInfoPic结束:返回:{}","传入参数错误");
            return  new Result(false,StatusCode.PARAMERROR,"传入参数错误");
        }
        Boolean b = service.updateServiceInfoPic(picParam);
        if (b){
            log.info("updateServiceInfoPic结束:返回:{}","修改服务详情图片成功");
            return  new Result(true,StatusCode.OK,"修改服务详情图片成功");
        }
        log.info("updateServiceInfoIcon结束:返回:{}","修改服务详情图片失败");
        return  new Result(false,StatusCode.ERROR,"修改服务详情图片失败");
    }

    /**
     * 功能描述〈修改销量redis〉
     * @author:fx
     * @param: @调用订单接口，传回订单数据
     * @return:
     * @Date 2021/4/12 13:36
     * @throws
     */

    @PutMapping("/ordinary/servicestatussale")
    public Result updateServcieInfoSaleByServiceInfoIdToRedis(){
        return null;
    }
}

